fix(wrap): prepend rtk bin dir to PATH for wrapped tools#1752
fix(wrap): prepend rtk bin dir to PATH for wrapped tools#1752ketpatil77 wants to merge 4 commits into
Conversation
PR governanceThis PR follows the template and is marked ready for human review. |
This reverts commit 80eb915.
JerrettDavis
left a comment
There was a problem hiding this comment.
The PATH injection is the right place to solve this, but this helper needs a Windows-safe environment-key handling pass before merge.
env comes from os.environ.copy() in the wrappers, and on Windows that commonly carries the executable search path under Path, not PATH. _prepend_rtk_bin_to_path() currently reads env.get("PATH", "") and writes env["PATH"], which can leave the existing Path entry untouched and add a second differently-cased key. With subprocess.run(..., env=env) on Windows, duplicate case variants are ambiguous and can result in the child still seeing the old Path, so the managed rtk bin directory may not actually be on the child search path.
Please resolve the existing path key case-insensitively, update that key in place, and add tests for a Windows-style env like { "Path": "C:\\Windows\\System32" } so we know the helper prepends to Path rather than creating a separate PATH. It would also be worth asserting the duplicate check works against the resolved key.
|
Pushed follow-up fix for review: resolve existing PATH/Path key case-insensitively, update that key in place, and add Windows-style env regression coverage. Re-ran targeted tests and ruff locally before push. |
|
Follow-up is already pushed for the requested Windows PATH/Path fix: the helper now resolves the existing path key case-insensitively, updates that key in place, and includes Windows-style env regression coverage plus duplicate-path coverage. Targeted pytest and ruff outputs are in the PR body. Re-review requested when convenient. |
Description
Make wrapped tools able to resolve Headroom-managed
rtkwithout requiring users to manually add~/.headroom/binto PATH.headroom wrapnow prepends the managed rtk bin directory to the child process PATH before launching the tool.Closes #1752
Type of Change
Changes Made
headroom/cli/wrap.py: added case-insensitive PATH-key resolution so Windows-stylePathentries are updated in place.headroom/cli/wrap.py: keeps duplicate prevention on the resolved path key instead of creating a secondPATHentry.tests/test_cli/test_wrap_helpers.py: added regression coverage for Windows-style env maps and duplicate prevention.Testing
pytest)ruff check .)mypy headroom)Test Output
Real Behavior Proof
_prepend_rtk_bin_to_path()regression tests against bothPATHand Windows-stylePathenv dictionaries, plus duplicate-path coverage.Pathkey in place without creating a second differently-cased entry.Review Readiness
Checklist
Additional Notes